package com.zhuozhou.jdyc.main.meinfo.adapter;

import android.content.Context;

import com.zhuozhou.jdyc.R;
import com.zhuozhou.jdyc.base.BaseRecyclerViewAdapter;
import com.zhuozhou.jdyc.base.BaseViewHolder;
import com.zhuozhou.jdyc.databinding.AdapterCheckBoxBinding;
import com.zhuozhou.jdyc.main.meinfo.bean.CheckBoxBean;

/**
 * Create by Once_ChuXy on 2021/10/5
 * Describe:
 */
public class CheckBoxAdapter extends BaseRecyclerViewAdapter<CheckBoxBean.ArrayBean, AdapterCheckBoxBinding> {
    public CheckBoxAdapter(Context context) {
        super(context);
    }

    @Override
    public void onBindHolder(BaseViewHolder<AdapterCheckBoxBinding> holder, int pos) {
        holder.getBinding().setText(mList.get(pos).getName());
        holder.getBinding().checkbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
            mList.get(pos).setCheck(isChecked);
        });
    }

    @Override
    protected int getLayoutId() {
        return R.layout.adapter_check_box;
    }

}
